package com.ayic.garbagerecycle.controller;

import com.ayic.garbagerecycle.pojo.Result;
import com.ayic.garbagerecycle.service.RecyclingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin(origins = "*", allowedHeaders = "*")
@RestController
@RequestMapping("/recycling")
public class RecyclingController {

    @Autowired
    private RecyclingService recyclingService;

    // 根据用户名获取当前用户统计信息
    @GetMapping("/statistics")
    public Result getRecyclingStatistics(@RequestParam String username) {
        return recyclingService.getRecyclingStatistics(username);
    }

    // 获取全部回收信息进行统计
    @GetMapping("/getAllRecords")
    public Result getAllRecords() {
        return recyclingService.getAllRecords();
    }
}